<?php 
/**
 * @Title: enclosing_method
 * @Description: 
 * @return: return_type
 * @author: yulong.wang
 * @date: 2015-1-15下午7:28:37
*/
use common\models\SysAdminUser;
use yii\helpers\Html;
$this->title = '站点--管理员--分配';
$this->params ['breadcrumbs'] [] = $this->title;
?>
<style>
.form-group{
	margin: 30px 0 30px 0;
}
.form-group span{
	font-size: 14px;
	border-color: #3c763d;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
	background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.075) inset;
    color: #555;
    font-size: 14px;
    height: 34px;
    line-height: 1.42857;
    padding: 6px 12px;
    transition: border-color 0.15s ease-in-out 0s, box-shadow 0.15s ease-in-out 0s;
}
</style>
<script>
function role(id){
	$.ajax({
    type:'GET',
    dataType:'json',
    url: '/sys-admin-user/admin-user-ajax?item='+id, 
    contentType:"application/json",
    success: function(data){
        if(data.length>0){
        	$("#admin_user").html(data);
        }
    }
});
}
</script>
<div>
    <h3><?php echo $this->title?></h3>
    <form action="/sys-admin-user/addsite" method="POST">
   
   
	   <div class="container-fluid">
		<div class="row-fluid">
			<div class="span12">
					<fieldset>
						 <legend></legend> 
						 <label></label>
						 <select class="dropdown-submenu" name='site_id' style="float:left">
						 <?php foreach ($sites as $key=>$value){?>
						 	<option style='padding-left:20px;' value='<?=$key;?>'><?=$value?></option>
						 <?php }?>
						 </select>
						 <select class="dropdown-submenu" style="margin-left: 200px;float:left" onchange="role(this.value)">
						 <option style='padding-left:20px;' value='产品部'>产品部</option>
						 <option style='padding-left:20px;' value='客服'>客服</option>
						 <option style='padding-left:20px;' value='江苏客服'>江苏客服</option>
						 <option style='padding-left:20px;' value='江苏产品'>江苏产品</option>
						 </select>
						 <br><br><br><br><br><br>
						 <div id="admin_user"> 
						 </div> 
					</fieldset>
			</div>
		</div>
	</div>
    <input type="button" value="全选" class="btn btn-success" style="padding:1px;"  id="choseAll"/>
	<input type="button" value="取消全选" class="btn btn-success" style="padding:1px;"  id="delAll"/>
	<input type="button" value="反选" class="btn btn-success" style="padding:1px;"  id="fanAll"/>
    <div class="form-group">
	   <button type="submit" class="btn" name='add'>提交</button>
	</div>
	</form>
</div>
<script>
//全部选择
	 $("#choseAll").click(function(){
		  $("input[name='admin_id[]']").each(function(){
			  this.checked = true;
		  });
	 });
	//取消选择
	 $("#delAll").click(function(){
		  $("input[name='admin_id[]']").each(function(){
			  this.checked = false;
		  });
	 });
	//反选
	 $("#fanAll").click(function(){
		  $("input[name='admin_id[]']").each(function(){
			if(this.checked == false){
				this.checked = true;
			}else{
				this.checked = false;
			}
		  });
	 });
</script>
<style>
.dropdown-submenu{display:block;width:250px;height:30px;margin-bottom:50px;font-size:14px;}
</style>